using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Data;
using Flynn.Core;

namespace FlynnGui.ViewModels
{
	public class ProjectViewModel : INotifyPropertyChanged
	{
		private string _projectName;
		private ObservableCollection<Update> _updates;

		public ProjectViewModel(Project project)
		{
			ProjectName = project.Name;
			_updates = new ObservableCollection<Update>(project.Updates.ToList());
		}

		public event PropertyChangedEventHandler PropertyChanged;

		public string ProjectName
		{
			get { return _projectName; }
			set
			{
				_projectName = value;
				NotifyPropertyChanged("ProjectName");
			}
		}

		public ObservableCollection<Update> Updates
		{
			get { return _updates; }
		}

		private void NotifyPropertyChanged(string info)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, new PropertyChangedEventArgs(info));
		}
	}
}